@extends('layouts/admin')
@section('content')
    <!--面包屑导航 开始-->
    <div class="crumb_warp">
        <!--<i class="fa fa-bell"></i> 欢迎使用登陆网站后台，建站的首选工具。-->
        <i class="fa fa-home"></i> <a href="{{url('admin/info')}}">首页</a> &raquo; <a href="{{url('admin/config')}}">配置列表</a> &raquo; 添加配置
    </div>
    <!--面包屑导航 结束-->

	<!--结果集标题与导航组件 开始-->
	<div class="result_wrap">
        <div class="result_title">
            <h3>配置分类管理</h3>
            @if(isset($errors) && count($errors) > 0)
                <div class="mark">
                    @if(is_object($errors))
                        @foreach($errors->all() as $error)
                            <p>{{  $error }}</p>
                        @endforeach
                    @else
                        <p>{{ $errors }}</p>
                    @endif
                </div>
            @endif
        </div>
        <div class="result_content">
            <div class="short_wrap">
                <a href="{{url('admin/config/create')}}"><i class="fa fa-plus"></i>添加配置</a>
                <a href="{{url('admin/config')}}"><i class="fa fa-recycle"></i>配置列表</a>
            </div>
        </div>
    </div>
    <!--结果集标题与导航组件 结束-->
    
    <div class="result_wrap">
        <form action="{{url('admin/config')}}" method="post">
            <table class="add_tab">
                <tbody>
                    <tr>
                        <th><i class="require">*</i>配置中文名称：</th>
                        <td>
                            {{csrf_field()}}
                            <input type="text" size="30" placeholder="名称" name="conf_title">
                            <span><i class="fa fa-exclamation-circle yellow"></i>这里必须输入内容</span>
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require">*</i>英文名称：</th>
                        <td>
                            <input type="text" size="30" placeholder="name" name="conf_name">
                            <span><i class="fa fa-exclamation-circle yellow"></i>这里必须输入内容</span>
                        </td>
                    </tr>
                    <tr>
                        <th><i class="require">*</i>类型：</th>
                        <td>
                            <select name="field_type" id="select_type" onchange="showTr()">
                                <option value="input">input</option>
                                <option value="textarea">textarea</option>
                                <option value="radio">radio</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="content">
                        <th>内容：</th>
                        <td>
                            <input type="text" size="50" name="field_value">
                            <span><i class="fa fa-exclamation-circle yellow"></i>只有类型为radio需要输入内容,(例：1|开启,0|关闭 )</span>
                        </td>
                    </tr>
                    <tr>
                        <th>描述：</th>
                        <td>
                            <textarea name="conf_tips" id="" cols="30" rows="10"></textarea>
                        </td>
                    </tr>

                    <tr>
                        <th></th>
                        <td>
                            <input type="submit" value="提交">
                            <input type="button" class="back" onclick="history.go(-1)" value="返回">
                        </td>
                    </tr>
                </tbody>
            </table>
        </form>
    </div>
    <script>
        showTr();
        function showTr() {
            var type = $('#select_type').val();
            if(type == 'radio') {
                $('#content').show();
            }else {
                $('#content').hide();
            }
        }
    </script>
@endsection